<script setup>
import Typed from "typed.js";
import { ref, onMounted } from "vue";

const talkList = ref({ data: [{ name: 1, type: 0 }] });

const itemRefs = ref([]);

onMounted(() => {
  console.log(itemRefs.value, "itemRefs.value");
  itemRefs.value.forEach((item, index) => {
    const typed = new Typed(item, {
      strings: [`test ${index}`],
      typeSpeed: 50,
    });
  });
});
</script>

<template>
  <ul>
    <li v-for="item in talkList.data" :key="item">
      1
      <div v-if="item.type == 0" ref="itemRefs"></div>
    </li>
  </ul>
</template>
